<template>
	<div>
		<tableIndex
			:tableData="state.tableData"
			:tableHead="state.tableHead"
			:isIndex="true"
			:height="'500'"
			:page="state.page"
			:not-search="true"
			@page-change="pageChange"
		>
			<template #operate>
				<el-table-column label="操作" align="center" fixed="right">
					<template #default="{ row }">
						<el-button
							size="small"
							class="button_edit"
							@click="lookItemHandler(row)"
							type="primary"
							>查看</el-button
						>
					</template>
				</el-table-column>
			</template>
		</tableIndex>

		<!-- 会议弹框 -->
		<profercenceDialog
			ref="profercencedialog"
			:isShow="false"
		></profercenceDialog>
	</div>
</template>
<script setup>
import { getURLhandler } from "@/views/constructionProjectManage/static/utools.js";

import profercenceDialog from "@/views/constructionProjectManage/mytobeDone/components/profercenceDialog.vue";
import "@/views/constructionProjectManage/static/button.scss";
import tableIndex from "@/components/table/index.vue";
import { ref, reactive, onMounted, computed } from "vue";
import { assetsApi } from "@/api/assets";
import { useRouter, useRoute } from "vue-router";
import { projectApi, projectListApi } from "@/api/project";
import { projectConfigApi } from "@/api/project";
const route = useRoute();
const projectId = getURLhandler(route.path).id;

const props = defineProps({
	tableData: {
		type: Array,
		default: [],
	},
});
const state = reactive({
	centerDialogVisible: false,
	activeName: "0",
	projectNames: "项目名称选择",
	page: {
		page: 1,
		pageSize: 10,
		total: 0,
	},
	areaTypeOptionsArr: [],
	formInline: {},
	selectList: [],
	tableData: [],
	tableHead: [
		{
			prop: "meetingName",
			label: "会议名称",
		},
		{
			prop: "type",
			label: "会议类型",
		},
		{
			prop: "participantsNames",
			label: "参会人员",
		},
		{
			prop: "meetingTime",
			label: "会议时间",
		},
		// {
		// 	prop: "examineStatus",
		// 	label: "会议结果",
		// 	formatter: (row) => {
		// 		return getStatus(row);
		// 	},
		// },
		{
			prop: "createUserName",
			label: "发起人",
		},
	],
});
const profercencedialog = ref(null);
const formInline = reactive({});
const pageChange = (e) => {
	state.page = e.page;
	state.pageSize = e.limit;
	getConferencePage();
};
let router = useRouter();
const lookItemHandler = (e) => {
  // console.log(e);
	// profercencedialog.value.open(e.id);
	router.push({
		path: `/constructionProjectManage/projectImplementationTask/organizeAMeeting/projectId=${
			e.projectId
		}&projectTaskId=${e.taskId}&itemId=${e.itemId}&isLook=${1}`,
	});
};

const getConferencePage = () => {
	projectConfigApi
		.getConferencePage({
			pageNum: state.page.page,
			pageSize: state.page.pageSize,
			param: {
				projectId,
				isDark:getURLhandler(route.path).isDark==='2'?'1':'0'
			},
		})
		.then((res) => {
			const { data, code, msg } = res;
			if (code == 200) {
				console.log(data);
				state.tableData = data.content;
				state.page.total = data.totalSize;
			}
		});
};

let getStatus = (row) => {
	let res = "";
	if (row.examineStatus === 1) {
		res = "待审核";
	} else if (row.examineStatus === 2) {
		res = "通过";
	} else if (row.examineStatus === 3) {
		res = "驳回";
	}
	return res;
};

onMounted(() => {
	getConferencePage();
});
</script>
<style lang="scss" scoped>
@import "@/assets/general_style/dialog.scss";
</style>
